package com.ethan.mvpdemo.module.login;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.ethan.mvpdemo.R;

public
/**
 * @Description:
 * @Author ethan
 * @CreateDate: 2021/12/7 10:16
 * @UpdateDate: 2021/12/7 10:16
 * @Version 1.0
 */
class LoginActivity extends AppCompatActivity  implements LoginContract.IView {

    LoginPresenter loginPresenter;
    EditText userName;
    EditText pwd;
    Button login;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        userName = findViewById(R.id.userName);
        pwd = findViewById(R.id.pwd);
        login = findViewById(R.id.login);
        login.setOnClickListener(v -> {
            loginPresenter.login(userName.getText().toString(),pwd.getText().toString());
        });

        loginPresenter = new LoginPresenter(this);
    }

    @Override
    public void loginSuccess() {
        Toast.makeText(LoginActivity.this,"成功",Toast.LENGTH_LONG).show();
    }

    @Override
    public void loginFail() {
        Toast.makeText(LoginActivity.this,"失败",Toast.LENGTH_LONG).show();
    }
}
